#include <stdio.h>
#include <string.h>


typedef long long LL;
const int N = 40000;
long long HarryPotterHashRand(const char *OriginalString) {
    char newString[0x3f3f];
    long long HashMOD = 101411234562527ll;
    memset(newString, 0, sizeof(newString));
    if (strlen(OriginalString) > 0x3f3e) return ((long long)(0xffffffff) - strlen(OriginalString));
    strcpy(newString + 1, OriginalString);
    long long seed = 111111111111111ll;
    for (int i = 1; newString[i] > 0; ++ i) {
        seed ^= (long long)(newString[i]) << 26;
        seed = ((seed << 1) + (seed << 2)) + (((long long)(newString[i]) << 34) * 10ll);
        seed *= newString[i] * 0xf;
        seed = (seed + HashMOD) % HashMOD;
    }
    return seed;
}
int n, k, c;
short wx[12000], X[N];
LL WHM[N];
char YM[N][1025];
void Dichotomous_search(long long x) {
    int l = 1, r = n, mid;
    while (l < r) {
        mid = (l + r) / 2;
        if (WHM[mid] >= x) r = mid; 
        else l = mid + 1;
    }
    printf("%d %s\n", X[r], YM[r]);
}
signed main() {
    scanf("%d %d %d", &n, &k, &c);
    for (int i = 1; i <= c; ++ i) {
        scanf("%d", wx + i);
        wx[i] += wx[i - 1];
    }
    int x_ = 1;
    for (int i = 1; i <= n; ++ i) {
        scanf("%s", YM[i]);
        WHM[i] = HarryPotterHashRand(YM[i]);
        while (wx[x_] < i) x_ ++;
        X[i] = x_;
    }
    LL numx;
    for (int i = 1; i <= k; ++ i) {
        scanf("%lld", &numx);
        Dichotomous_search(numx);
    }
    return 0;
}